<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCoursePackageXCoursesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('course_package_x_courses', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('course_package_id') ->default(0)->comment('套餐id');
            $table->bigInteger('course_id')         ->default(0)->comment('课程id');
            $table->tinyInteger('is_must')          ->default(0)->comment('是否必选');
            $table->decimal('discount_price')       ->default(0)->comment('优惠价格');
            $table->unsignedInteger('remain_num')   ->default(0)->comment('剩余数量');
            $table->unsignedInteger('sold_num')     ->default(0)->comment('售出数量');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
//        Schema::dropIfExists('course_package_x_courses');
    }
}
